<!-- Memo Field -->
<label for="memo" class="col-sm-3 control-label text-left">
    Memo
    <a href="#" data-toggle="tooltip" title='This is an optional memo to include' class="pull-right"><i class="fa fa-lg fa-question-circle-o margin-top-5" ></i></a>
</label>
<div class="col-sm-9">
    <div class="input-group pull-right" style="width:180px" id="memo-type-wrapper">
        <span class="input-group-addon">Type</span>
        <select id="memo-type" name="memo-type" class="selectpicker">
            <option value="text">Text</option>
            <option value="data">Data</option>
        </select>
    </div>
    <input type="text" class="form-control" name="memo"  id="memo" placeholder="Enter Memo / Note" style="width:220px">
</div>

<script>

$(document).ready(function(){

    var type = getFormType();

    if(type=='destroy'){
        $('#memo-type-wrapper').hide();
        $('#memo').css('width', '100%');
    } else if(type=='sweep'){
        $('#memo').css('width', '225px');
    } else if(type=='send'){
        $('#memo-type-wrapper').css('width', '160px');
    }

    // Handle Disabling the memo for BTC transactions
    $('#token-name-select').change(function(e){
        var val = $(this).val(),
            el  = $('#memo');
        // If this is BTC, hardcode the values and skip getting asset info
        if(val=='BTC'){
            // Disable the memo
            el.attr('disabled', true);
            el.val('');
        } else {
            el.attr('disabled', false);
        }
    });
    
    // Make memo type a dropdown
    $('#memo-type').selectpicker();

    $('#memo').change(function(e){
        // Handle updating the transaction fee based on actual tx size
        if(type=='sweep'||type=='destroy'||type=='send')
            updateTransactionSize();
    });


});
</script>